package com.starsea.book.ui.newpage.adapter

import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.starsea.book.databinding.ItemBookDepScreenOtherBinding
import com.starsea.book.ui.newpage.entity.BookTabTitleEntity

/**
 * @author Lee
 * @createTime 2024-07-12 20 GMT+8
 * @desc :
 */
class BookDepositoryScreenOtherAdapter(var mContext: Context) :
  BaseQuickAdapter<BookTabTitleEntity, BookDepositoryScreenOtherAdapter.MyViewHolder>() {

  override fun bindViewClickListener(viewHolder: MyViewHolder, viewType: Int) {
    super.bindViewClickListener(viewHolder, viewType)
  }


  override fun onBindViewHolder(holder: MyViewHolder, position: Int, item: BookTabTitleEntity?) {

    holder.binding.tvTitle.isSelected = item!!.isSelect
    holder.binding.tvTitle.text = item.name
  }

  override fun onCreateViewHolder(
    context: Context,
    parent: ViewGroup,
    viewType: Int,
  ): MyViewHolder {
    return MyViewHolder(parent = parent)
  }

  class MyViewHolder(
    parent: ViewGroup,
    val binding: ItemBookDepScreenOtherBinding = ItemBookDepScreenOtherBinding.inflate(
      LayoutInflater.from(parent.context), parent, false
    ),
  ) : RecyclerView.ViewHolder(binding.root)

}